//
//  UIFont(extension).swift
//
//  Created by 董振山 on 2018/4/17.
//  Copyright © 2018年 董振山. All rights reserved.
//

import Foundation
import UIKit
extension UIFont{
   public enum FontStyleName {
        case medium
        case semibld
        case regular
        case light
        case bold
        case thin
        case heavy
        case other(String)
    }
    /**
     * @param fontType 字体样式 other需传入其他字体名字
     * @param fontSize 字体的大小
     */
    convenience init(fontType:FontStyleName,fontSize:CGFloat){
        var fontStyleStr = ""
        switch fontType {
        case .medium:
            fontStyleStr = "PingFangSC-Medium"
            break
        case .semibld:
            fontStyleStr = "PingFangSC-Semibold"
            break
        case .regular:
            fontStyleStr = "PingFangSC-Regular"
            break
        case .light:
            fontStyleStr = "PingFangSC-Light"
            break
        case .bold:
            fontStyleStr = "PingFangSC-Bold"
            break
        case .thin:
            fontStyleStr = "PingFangSC-Thin"
            break
        case .heavy:
            fontStyleStr = "PingFangSC-Heavy"
            break
        case .other(let str):
            fontStyleStr = str
            break
        }
        self.init(name: fontStyleStr, size: fontSize)!
    }

}
